﻿using Ndns.Packet.Abstractions.ResourceRecords;

namespace Ndns.Packet.Abstractions
{
    public abstract class DnsResourceRecord
    {
        /// <summary>
        /// 表示DNS应答的名称。
        /// </summary>
        public abstract DnsHostName HostName { get; set; }

        /// <summary>
        /// 表示DNS的应答类型。
        /// </summary>
        public abstract DnsRecordType Type { get; protected set; }

        /// <summary>
        /// 表示DNS的类型。
        /// </summary>
        public abstract DnsClass Class { get; protected set; }

        /// <summary>
        /// 表示DNS应答的生存时间。
        /// </summary>
        public virtual uint TTL { get; set; }

        protected DnsResourceRecord()
        {
            HostName = new DnsHostName();
            Class = DnsClass.Internet;
            TTL = 0;
        }

        protected DnsResourceRecord(DnsHostName hostName, DnsClass c, uint ttl)
        {
            HostName = hostName;
            Class = c;
            TTL = ttl;
        }


        public abstract DnsResourceRecord Clone();

        public virtual CustomDnsResourceRecord AsCustomDnsResourceRecord()
        {
            return null;
        }
    }
}
